<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'     => config('admin.route.prefix'),
    'namespace'  => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');

    //****接口路由****

    $router->group(['prefix' => 'api'], function ($router) {
        $router->get('swt_good/getGoodsPrice', 'SwtGoodController@getGoodsPrice');
    });


    //****页面路由****

    $router->resource('swt_good', 'SwtGoodController');

    $router->resource('swt_request_log', 'SwtRequestLogController');

    $router->group(['prefix' => 'auth'], function ($router) {
        $router->resource('auth/users', 'UserController');

        $router->resource('auth/roles', 'RoleController');
    });

    $router->group(['prefix' => 'merchant'], function ($router) {
        $router->resource('swt_merchant', 'Merchant\SwtMerchantController');

        $router->resource('swt_merchant_profit', 'Merchant\SwtMerchantProfitController');

        $router->resource('swt_users', 'Merchant\SwtUserController');
    });

    $router->group(['prefix' => 'machine'], function ($router) {
        $router->resource('swt_machine', 'Machine\SwtMachineController');

        $router->resource('swt_machine_good', 'Machine\SwtMachineGoodController');

        $router->resource('swt_machine_goods_log', 'Machine\SwtMachineGoodsLogController');

        $router->resource('swt_replenish', 'Machine\SwtReplenishController');
    });

    $router->group(['prefix' => 'order'], function ($router) {
        $router->resource('swt_order', 'Order\SwtOrderController');

        $router->resource('swt_order_refund', 'Order\SwtOrderRefundController');
    });

    $router->group(['prefix' => 'iot'], function ($router) {
        $router->resource('iot_product', 'Iot\IotProductController');

        $router->resource('iot_device', 'Iot\IotDeviceController');
    });

    $router->group(['prefix' => 'dhe'], function ($router) {
        $router->resource('swt_dhe_order', 'Dhe\SwtDheOrderController');

        $router->resource('swt_dhe_machine', 'Dhe\SwtDheMachineController');

        $router->resource('swt_dhe_good', 'Dhe\SwtDheGoodController');

    });

    $router->group(['prefix' => 'bj'], function ($router) {
        $router->resource('swt_bj_async_order', 'Bj\SwtBjAsyncOrderController');

        $router->resource('swt_bj_machine', 'Bj\SwtBjMachineController');

        $router->resource('swt_bj_open', 'Bj\SwtBjOpenController');
    });

    $router->group(['prefix' => 'ty'], function ($router) {
        $router->resource('swt_ty_good', 'Ty\SwtTyGoodController');
    });

    $router->group(['prefix' => 'invoicing'], function ($router) {
        //采购入库
        $router->resource('swt_procurement', 'Invoicing\SwtProcurementController');
        //补货出库
        $router->resource('swt_replenishment', 'Invoicing\SwtReplenishmentController');
        //员工管理
        $router->resource('swt_employee', 'Invoicing\SwtEmployeeController');
    });
});
